package com.lenovo.lcdm.team.service;

import com.lenovo.lcdm.team.entity.TeamUser;
import com.lenovo.lcdm.team.entity.TeamUserGroup;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;
import java.util.Set;

/**
 * User-Group Service
 * @author xujing30
 * @since 2023-12-22
 */
public interface ITeamUserGroupService extends IService<TeamUserGroup> {

    /**
     * 保存用户组关系
     * @param user
     * @param groups
     */
    void saveOrUpdateUserGroups(TeamUser user, Set<Long> groups);

    /**
     * 根据userId查所有group
     * @param userId
     * @return
     */
    List<TeamUserGroup> getGroupByUserId(Long userId);

    /**
     * 获取拥有groupId权限的所有user
     * @param groupId
     * @return
     */
    List<TeamUserGroup> getUserByGroupId(Long groupId);

}
